Imports System
Imports System.Web

Imports MetaSapiens.PageMethods

Public Class HttpHandlerBehind
  Implements IHttpHandler

  Private _context As HttpContext

  Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
    _context = context
    PageMethodsEngine.InvokeMethod(Me, True)
  End Sub

  Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
      Return False
    End Get
  End Property

  <PageMethod(True), UrlFormat("~/HttpHandlerBehind.ashx?i={i}")> _
  Public Sub SampleMethod(ByVal i As Integer)
    _context.Response.ContentType = "text/plain"
    _context.Response.Write("Hello from HTTP handler (code behind). i = " + i.ToString())
  End Sub

End Class
